package cw.is.besti.edu.cn.activitypractice;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class MainActivity extends Activity implements View.OnClickListener{
    String msg = "Shiyanlou :";
    Button pushBtn ;
    Button popBtn;

    // 当Activity首次启动时会调用onCreate()方法
    // 可以简单理解为传统java程序中的main()方法
    // 通常你需要重写这个方法，在其中加载界面的布局，初始化各类控件等
    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Log.d(msg,"The function onCreate() was called.");
        pushBtn = (Button)findViewById(R.id.push);
        pushBtn.setOnClickListener(this);
        popBtn = (Button)findViewById(R.id.pop);
        pushBtn.setOnClickListener(this);
    }
    @Override
    protected void onStart() {

        // 当Activity即将变得可见时会调用onStart()方法
        super.onStart();
        Log.d(msg,"The function onStart() was called.");
    }

    // 当Activity已经变得可见时会调用onResume()方法
    @Override
    protected void onResume() {
        super.onResume();
        Log.d(msg,"The function onResume() was called.");
    }

    // 当其他的Activity已经获得了焦点时会调用onPause()方法
    @Override
    protected void onPause(){
        super.onPause();
        Log.d(msg,"The function onPause() was called.");
    }
    @Override
    protected void onStop(){
        super.onStop();
        Log.d(msg,"The function onStop() was called.");
    }

    @Override
    protected void onDestroy(){
        super.onDestroy();
        Log.d(msg,"The function onDestroy() was called.");
    }

    @Override
    public void onClick(View view) {
        ArrayStack arr = new ArrayStack();
      if(  view.getId()==R.id.push){
          arr.push(R.id.ettext);
      }
      if (view.getId() == R.id.pop){
          arr.pop();
      }
    }
}
